﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LeafBookmark.Data;

namespace LeafBookmark.ViewModels
{
    class BookmarkViewModel : IBookmark
    {
        public bool IsKey { get; set; }
        public string Title { get; set; }
        public Uri Url { get; set; }
        public DateTime CreatedTime 
        { 
            get 
            {
                return createdTime;
            }
            private set
            {
                if (value != createdTime)
                {
                    createdTime = value;
                }

            }
        }

        DateTime createdTime;

        public BookmarkViewModel(IBookmark bookmark)
        {
            Title = bookmark.Title;
            Url = bookmark.Url;
            CreatedTime = bookmark.CreatedTime;
        }

        public BookmarkViewModel(string name, string url)
        {
            Title = name;
            Url = new Uri(url);
        }
    }
}
